//
//  UIButton+BZTheme.m
//  MZBasic
//
//  Created by Sings on 2022/9/14.
//

#import "UIButton+BZTheme.h"

@implementation UIButton (BZTheme)

- (void)BZTheme_setTintImage:(nullable UIImage *)image forState:(UIControlState)state AndTintColorKey:(NSString *) strTintColorKey {
    if (strTintColorKey != nil) {
        image = [image imageWithRenderingMode:(UIImageRenderingModeAlwaysTemplate)];
        self.imageView.tintColor = BZTHEME_COLOR(strTintColorKey);
        [self setImage:image forState:state];
    }else {
        [self setImage:image forState:state];
    }
}

- (void)BZTheme_setTintBackgroundImage:(nullable UIImage *)image forState:(UIControlState)state AndTintColorKey:(NSString *) strTintColorKey {
    if (strTintColorKey != nil) {
        image = [image imageWithRenderingMode:(UIImageRenderingModeAlwaysTemplate)];
        self.tintColor = BZTHEME_COLOR(strTintColorKey);
        [self setBackgroundImage:image forState:state];
    }else {
        [self setBackgroundImage:image forState:state];
    }
}

@end
